// 定义组件
define(function (require, exports, module) {
  var tools = {
    getUrlParamsMap() {
      var url = location.search; // 获取url中"?"符后的字串
      var theRequest = { }
      if (url.indexOf('?') != -1) {
        var str = url.substr(1)
        strs = str.split('&')
        for (var i = 0; i < strs.length; i++) {
          theRequest[strs[i].split('=')[0]] = unescape(strs[i].split('=')[1])
        }
      }
      return theRequest
    },
    toQueryString(obj) {
      var obj = obj || this
      var arr = []
      for (key in obj) {
        arr.push(key + '=' + obj[key])
      }
      return arr.join('&')
    }
  }

  module.exports = tools
})
